<?php 
require'header.php';
$data=require'db.php';
$id=array();
foreach ($data as $k => $d) {
	if (strchr($d['title'],$_POST['wd'])) $id[$k]='';
	if (strchr($d['content'],$_POST['wd']))$id[$k]='';
}
 ?>
 <h1><a href="index.php">返回首页</a></h1>
 <?php foreach ($data as $k => $field) {
 	if (!isset($id[$k])) continue;
 	$field['title']=str_replace($_POST['wd'], '<b style="color:#f00">'.$_POST['wd'].'</b>', $field['title']);
 	$field['content']=str_replace($_POST['wd'], '<b style="color:#f00">'.$_POST['wd'].'</b>', $field['content']); ?>
<dl>
	<dt><?php echo $field['title'] ?><span>(<?php echo $field['time']; ?>)</span></dt>
	<dd>
		<?php echo $field['content']; ?>
	</dd>
</dl>
 <?php } ?>
<style type="text/css">
body{padding:20px;}
	*{padding:0px;margin:0px;}
	span.error{color:#f00;border:solid 1px #f00;padding:5px;}
	dl{
		border:solid 1px #999;padding:15px;
		margin-bottom: 10px;
	}
	dl dt{border-bottom: solid 1px #999;}
	dl dt span{float:right;}
	dl dd{
		padding-top:10px;
	}
</style>
